Output PWM Frequency and Duty Cycle

  • Function:

    magicbox.set_pwm(port, frequency, duty_cycle)
    
  • Description: set frequency and duty cycle of PWM output port

  • Required parameter:

    • port: EIO address, range: 1~26
    • frequency: PWM frequency. range: 16Hz~10KHz
    • duty_cycle: duty cycle, range: 0~100
  • Return:
    • True: The command has been finished.
    • False: The command has not been finished.
  • Example

    magicbox.set_pwm(port=1, frequency=16.2, duty_cycle=30.0)
    

    Set PWM frequency of EIO1 port as 16.2Hz, and duty cycle as 30%.

results matching ""

    No results matching ""